#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main()
{
    int n = 0;

    while (scanf("%d", &n) != EOF)
    {
        for (int j = 0;j < n;j++)
        {
            char arr[100000] = { 0 };
            scanf("%s", &arr);
            int majuscule = 0;
            int lowercase = 0;
            int numerical = 0;
            int other = 0;
            int sz = strlen(arr);
            if (sz < 8 || sz>100)
            {
                printf("NO\n");
                continue;
            }
            if (arr[0] >= '0' && arr[0] <= 9)
            {
                printf("NO\n");
                continue;
            }
            for (int i = 0;i < sz;i++)
            {
                if (arr[i] >= 'A' && arr[i] <= 'Z')
                {
                    majuscule++;
                }
                else if (arr[i] >= 'a' && arr[i] <= 'z')
                {
                    lowercase++;
                }
                else  if (arr[i] >= '0' && arr[i] <= '9')
                {
                    numerical++;
                }
                else
                {
                    printf("NO");
                    continue;
                }
            }
            if ((majuscule > 0) + (lowercase > 0) + (numerical > 0) >= 2)
            {
                printf("YES\n");
            }
            else
            {
                printf("NO\n");
            }
        }
    }
    return 0;
}